import { defineComponent, h,onBeforeMount,reactive,ref } from "vue";
import "./index.css"
import {px_e_rem} from "@uit/common.js"
import {versions} from "../../services/api"
const Download = defineComponent({
    data(){
        return{

        }
    },
    setup(props,{}){
        
        const data = reactive({
            andriod:'',
            h5:''
        })

        const to_url = (url) =>{
            window.open(url)
        }

        onBeforeMount(()=>{
            versions({type:'android'}).then(res=>{
                if(res.code==0){
                    data.andriod = res.data.path
                }
            })
            versions({type:'ios'}).then(res=>{
                if(res.code==0){
                    data.h5 = res.data.path
                }
            })
        })

        return ()=>h('div',{class:'download'},[
            h('img',{src:require('../../assets/imgs/download_show.png'),style:{width:px_e_rem(540),height:px_e_rem(1000),marginTop:px_e_rem(132)}}),
            h('div',{class:'download_btns'},[
                h('button',{onclick:()=>to_url(data.andriod)},[
                    h('img',{src:require('../../assets/imgs/download_btn_andriods.png')}),
                    'Android'
                ]),
                h('button',{onclick:()=>to_url(data.h5)},'H5')
            ]),
            h('img',{src:require("../../assets/imgs/download_bg1.png"),class:'download_float'}),
            h('img',{src:require("../../assets/imgs/download_bg2.png"),class:'download_float1'})
        ])
    },
})

export default Download